package com.ugoodtech.mdcc.web.exception;

public class BizException extends CommonException implements CommonError{

  private CommonError commonError;

  public BizException(CommonError commonError){
    super();
    this.commonError = commonError;
  }

  public BizException(final Exception e){
    commonError = new CommonError() {
      @Override
      public String getErrCode() {
        return "1001";
      }

      @Override
      public String getErrMsg() {
        return "未知异常";
      }

      @Override
      public String getDetailErrMsg() {
        return e.getMessage();
      }
    };
  }

  @Override
  public String getErrCode() {
    return commonError.getErrCode();
  }

  @Override
  public String getErrMsg() {
    return commonError.getErrMsg();
  }

  @Override
  public String getDetailErrMsg() {
    return commonError.getDetailErrMsg();
  }
}
